package br.com.roteadroid;

import roboguice.activity.RoboActivity;
import roboguice.inject.ContentView;
import roboguice.inject.InjectView;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import br.com.roteadroid.activity.MenuActivity;
import br.com.roteadroid.util.MessageUtils;

@ContentView(R.layout.activity_main)
public class InicioActivity extends RoboActivity {
	@InjectView(R.id.entrarBotao) Button botaoEntrar;
	@InjectView(R.id.nomeMotoristaText) EditText nomeMotorista;
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
        ComponentName name = startService(new Intent("INICIAR_SERVICO_ROTEADOR"));
        Log.d("servico", name.getClassName());
        botaoEntrar.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
            	if(!"".equals(nomeMotorista.getText().toString())){
	            	Intent myIntent = new Intent(v.getContext(), MenuActivity.class);
	        		v.getContext().startActivity(myIntent);
            	} else {
            		MessageUtils.mensagem(v.getContext(), "Digite o nome do motorista.");
            	}
            }
        });
    }
	
}